package com.itheima.a03StaticDemo3;

public class Student {
    private String name;
    private int age;
    public static String teacherName;

    public Student() {
    }

    public Student(String name, int age) {
        this.name = name;
        this.age = age;
    }

    /**
     * 获取
     * @return name
     */
    public String getName() {
        return name;
    }

    /**
     * 设置
     * @param name
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * 获取
     * @return age
     */
    public int getAge() {
        return age;
    }

    /**
     * 设置
     * @param age
     */
    public void setAge(int age) {
        this.age = age;
    }

    public String toString() {
        return "Student{name = " + name + ", age = " + age + "}";
    }

    public void show(){
        System.out.println(name + ", " + age + ", " + teacherName);
    }

    /*
    * this 表示当前方法调用的地址值，是由虚拟机赋值的，可省略
    * */
    public void show1(Student this){
        System.out.println("this:" + this);
        System.out.println(this.name + ", " + this.age + ", " + teacherName);
    }

    public  void show2(){
        System.out.println("show2");
    }

    /*
    * 静态方法没有this关键字
    * */
    public static void method(){
        // 静态方法无法调用非静态方法
        System.out.println("show2");
    }
}
